# include <iostream> 
using namespace std;
const int& add(int& res, const int& op1, const int& op2){
                              res=op1+op2;
							  // int t=res;
                              // return t; // can not return reference of local variable, always with return type T or const T&
                              return res;
}


const int* add2(int& res, const int& op1, const int& op2){
                              res=op1+op2;
							  // int t=res;
                              // return t; // can not return reference of local variable, always with return type T or const T&
                              return &res;
}


int main(){
                int res=0, a=5, b=6;
                const int& r=add(res,a,b);
                // int& r=add(res,a,b);
				const int cst=4;
				const int * const cst_ptr=&cst;
				const int * pt;
				if (true) {
						cout << "add2" << endl;
						int* res1= new int(10);
						a=10;
						int & res=(int &) (*res1); 

						pt=add2(res,a,b);
						delete res1;
						cout << "res inside add2:" << res << endl;

						cout <<"II * pt:"<< *pt << endl;
						res1= new int(26);
						cout <<"II * pt:"<< *pt << endl;
				
				}
				//	cst_ptr=&a;
				// cout << *cst_ptr << endl;
				cout <<"r: "<< r << "\t" << "res:" << res << endl;
                // r=4; // now res=4 also, which is unexpected 
				// cout <<"r: "<< r << "\t" << "res:" << res << endl;
				// cout <<"* pt:"<< *pt << endl;
}
